package cn.com.wangluotongxin.admin.model.constants;

public enum MenuType {
    MENU(1, "菜单"),
    BUTTOM(2, "按钮");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static MenuType getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            MenuType[] menuTypes = values();
            for(MenuType menuType : menuTypes){
                if(menuType.getCode().equals(code)){
                    return menuType;
                }
            }
        }
        return null;
    }

    MenuType(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
